angular.module('GetStock')

.factory('GetStockHomeService', ['$q', 'Http',
    function($q, Http) {
       //获取要货看板数据
       function getGetStockData (userId) {
            var defer = $q.defer();

            Http.post({
                url: "/api/Kanban/GetDownStreamKanban",
                data: {
                    Parameter: {
                        userId: userId
                    }
                }
            }).then(function (data) {
                defer.resolve(data); 
            }, function (err) {
                defer.reject(err);
            });

            return defer.promise;
        }
        //获取要货看板交接区信息
       function getConnectArea (terminalId) {
            var defer = $q.defer();

            Http.post({
                url: "/api/Kanban/queryConnectAreaByTerminal",
                data: {
                    Parameter: {
                        uniqueID: terminalId,
                        isUp:false
                    }
                }
            }).then(function (data) {
                defer.resolve(data); 
            }, function (err) {
                defer.reject(err);
            });

            return defer.promise;
        }

        return{
            getGetStockData:getGetStockData,
            getConnectArea:getConnectArea
        };
     
    }
]);
